<?php 
include_once "../includes/myfunction.php";
include_once "../ini.php";
include "../thu_vien/xl_user.php";
include "../thu_vien/xl_work.php";
include "../thu_vien/xl_position.php";
include "../thu_vien/xl_location.php";
include "../thu_vien/xl_employer.php";
include "../thu_vien/xl_education.php";
include "../thu_vien/xl_class.php";
include "../thu_vien/xl_school.php";
include "../thu_vien/xl_class_member.php";
include "../thu_vien/xl_concentration.php";
include "../thu_vien/xl_concentration_member.php";

function kiem_tra_gioi_tinh($gioi_tinh, $gia_tri){
	if ($gioi_tinh == $gia_tri){
		return 'checked="checked"';
	}
	else return '';
}

function kiem_tra_trang_thai_quan_he($trang_thai_quan_he, $gia_tri){
	if ($trang_thai_quan_he == $gia_tri){
		return 'selected="1"';
	}
	else return '';
}

/*if (empty($_GET['uid']) || !is_numeric($_GET['uid']) ) {
		$_SESSION['msg'] = 'Lỗi ! Dữ liệu không hợp lệ.';
		$_SESSION['type_msg'] = 'error';
		header('Location: '.$_SERVER['HTTP_REFERER']);
		exit;
	}	*/	
	
	
$uid = $_GET['id'];
if ($uid == '')
	$uid = '572061230';

$dt_xl_user = new xl_user;
$dt_xl_work = new xl_work;
$dt_xl_position = new xl_position;
$dt_xl_location = new xl_location;
$dt_xl_employer = new xl_employer;
$dt_xl_education = new xl_education;

$dt_xl_education = new xl_education;
$dt_xl_class = new xl_class;
$dt_xl_school = new xl_school;
$dt_xl_class_member = new xl_class_member;
$dt_xl_concentration = new xl_concentration;
$dt_xl_concentration_member = new xl_concentration_member;

$user = $dt_xl_user->xem($uid);
$work = $dt_xl_work->xem($uid);
$edu = $dt_xl_education->xem($uid);

			
			
/*if ($user['hinh']=='')
		$san_pham['hinh']='no_photo.jpg';*/
		
/*if ($user == NULL) {
	$_SESSION['msg'] = 'Lỗi ! Mã user không tồn tại.';
	$_SESSION['type_msg'] = 'error';
	header('Location: ../wall/index.php');
	exit;		
}*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US" xml:lang="en">
<head>
<!--
    Created by Artisteer v3.0.0.35414
    Base template (without user's data) checked by http://validator.w3.org : "This page is valid XHTML 1.0 Transitional"
    -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
<title>SnS</title>
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" />
<!--[if IE 6]><link rel="stylesheet" href="../css/style.ie6.css" type="text/css" media="screen" /><![endif]-->
<!--[if IE 7]><link rel="stylesheet" href="../css/style.ie7.css" type="text/css" media="screen" /><![endif]-->
<link rel="stylesheet" href="../css/mystyle.css" type="text/css" media="screen" />
<script type="text/javascript" src="../css/jquery.js"></script>
<script type="text/javascript" src="../css/script.js"></script>

<!--Begin: Date picker-->
<link href="../js/jquery/themes/cupertino/jquery-ui-1.8.16.custom.css" rel="stylesheet" type="text/css"/>
<script src="../js/jquery/jquery-1.4.4.js"></script>
<script src="../js/jquery/ui/jquery-ui-1.8.9.custom.js"></script>
<!--End: Date picker-->
</head>
<body>
<div id="art-page-background-glare">
  <div id="art-page-background-glare-image">
    <div id="art-main">
      <div class="art-sheet">
        <div class="art-sheet-tl"></div>
        <div class="art-sheet-tr"></div>
        <div class="art-sheet-bl"></div>
        <div class="art-sheet-br"></div>
        <div class="art-sheet-tc"></div>
        <div class="art-sheet-bc"></div>
        <div class="art-sheet-cl"></div>
        <div class="art-sheet-cr"></div>
        <div class="art-sheet-cc"></div>
        <div class="art-sheet-body"> 
          <!--BEGIN: HEADER-->
          <?php include "../widgets/header.php"; ?>
          <!--END: HEADER--> 
          <!--BEGIN: NAVIGATION MENU-->
          <?php include "../widgets/nav.php"; ?>
          <!--END: NAVIGATION MENU-->
          
          <div class="art-content-layout">
            <div class="art-content-layout-row">
              <div class="art-layout-cell art-sidebar1">
                <div class="art-vmenublock">
                  <div class="art-vmenublock-tl"></div>
                  <div class="art-vmenublock-tr"></div>
                  <div class="art-vmenublock-bl"></div>
                  <div class="art-vmenublock-br"></div>
                  <div class="art-vmenublock-tc"></div>
                  <div class="art-vmenublock-bc"></div>
                  <div class="art-vmenublock-cl"></div>
                  <div class="art-vmenublock-cr"></div>
                  <div class="art-vmenublock-cc"></div>
                  <div class="art-vmenublock-body"> <img src="<?php echo $user['pic'];?>" width="170"/>
                    <div class="cleared"></div>
                  </div>
                </div>
                <!--BEGIN: VERTICAL MENU-->
                <?php
					   $pos = 'left'; 
					   sidebar($pos);
					   ?>
                <!--END: VERTICAL MENU-->
                
                <div class="cleared"></div>
              </div>
              <div class="art-layout-cell art-content">
                <div class="art-post">
                  <div class="art-post-body">
                    <div class="art-post-inner art-article">
                      <h2 class="art-postheader"><a class="hovered" href="#"><?php echo $user['name']?></a><img class="mui_ten" src="../images/right.png" />Chỉnh sửa thông tin</h2>
                      <div class="line"></div>
                      <div class="art-postcontent">
                      <?php message();?>
                       <form method="post" action="edit_sm.php" name="f2" />
                       <input type="hidden" name="uid" value="<?php echo $uid ?>"/>
                        <div class="chua_table">
                          <table cellspacing="0" cellpadding="0" class="thanh_toan">
                            <tbody>
                              <tr>
                                <td colspan="2" class="thong_tin"><img class="down_arrow" src="../images/down.png" /><strong>Thông tin cơ bản</strong></td>
                              </tr>
                              <tr>
                                <td class="l">Họ tên:</td>
                                <td class="r"><input type="text" size="70" name="name" class="data" value="<?php echo $user['name']?>"></td>
                              </tr>
                             
                              <tr>
                                <td class="l">Ngày sinh:</td>
                                 <script>
				$(function() {
					$( "#datepicker" ).datepicker({
						showOn: "button",
						buttonImage: "../images/calendar.gif",
						buttonImageOnly: true,
						dateFormat: 'dd/mm/yy',
						changeMonth: true,
						changeYear: true
					});
				});
				</script>
                                <td class="r"><input class="text-input small-input" type="text" style="vertical-align: middle;" id="datepicker" name="birthday" value="<?php echo $user['birthday'];?>" /></td>
                              </tr>
                             
                              <tr>
                                <td class="l">Giới tính:</td>
                                
                                <td style="text-align:left !important; padding-left: 0px !important;" class="r"><input type="radio" <?php echo kiem_tra_gioi_tinh($user['sex'],'male');?> value="male" name="sex" class="radio">
                              <span style="vertical-align: middle;">Nam</span>
                              <input type="radio" name="sex" class="radio" value="female" <?php echo kiem_tra_gioi_tinh($user['sex'],'female');?>>
                              <span style="vertical-align: middle;">Nữ</span></td>
                              </tr>
                             
                            
                             
                              <tr>
                                <td class="l">Tình trạng quan hệ:</td>
                                <td class="r">
								<select id="ul0n6c_10" class="relationSelector" name="relationship_status">
<option value="" <?php echo kiem_tra_trang_thai_quan_he($user['relationship_status'],'');?>>Chọn Mối Quan Hệ:</option>
<option value="Single" <?php echo kiem_tra_trang_thai_quan_he($user['relationship_status'],'Single');?>>Độc thân</option>
<option <?php echo kiem_tra_trang_thai_quan_he($user['relationship_status'],'In a relationship');?> value="In a relationship">Đang hẹn hò</option>
<option <?php echo kiem_tra_trang_thai_quan_he($user['relationship_status'],'Engaged');?> value="Engaged">Đã đính hôn</option>
<option <?php echo kiem_tra_trang_thai_quan_he($user['relationship_status'],'Married');?> value="Married">Đã kết hôn</option>
<option <?php echo kiem_tra_trang_thai_quan_he($user['relationship_status'],"It's complicated");?> value="It's complicated">Rất phức tạp</option>
<option <?php echo kiem_tra_trang_thai_quan_he($user['relationship_status'],'In an open relationship');?> value="In an open relationship">Quan hệ mở</option>
<option <?php echo kiem_tra_trang_thai_quan_he($user['relationship_status'],'Widowed');?> value="Widowed">Góa</option>
<option <?php echo kiem_tra_trang_thai_quan_he($user['relationship_status'],'Separated');?> value="Separated">Ly thân</option>
<option <?php echo kiem_tra_trang_thai_quan_he($user['relationship_status'],'Divorced');?> value="Divorced">Ly dị</option>
</select>
								
								</td>
                              </tr>
                             
                              <tr>
                                <td class="l">Ngôn ngữ:</td>
                                <td class="r"><input type="text" size="70" name="languages" class="data" value="<?php echo $user['languages']?>" /></td>
                              </tr>
                              
                              <tr>
                                <td class="l">Quan điểm tôn giáo: </td>
                                <td class="r"><input type="text" size="70" name="religion" class="data"  value="<?php echo $user['religion']?>" /></td>
                              </tr>
                             
                              <tr>
                                <td class="l">Quan điểm chính trị: </td>
                                <td class="r"><input type="text" size="70" name="political" class="data"  value="<?php echo $user['political']?>" /></td>
                              </tr>
                              
                              <tr>
                                <td class="l">Quê quán: </td>
                                <td class="r"><input type="text" size="70" name="hometown_location" class="data"  value="<?php echo $user['hometown_location']?>" /></td>
                              </tr>
                              
                              <tr>
                                <td class="l">Nơi ở hiện tại: </td>
                                <td class="r"><input type="text" size="70" name="current_location" class="data" value="<?php echo $user['current_location']?>" /></td>
                              </tr>
                             
                              <tr>
                                <td class="l">Tự bạch: </td>
                                <td class="r"><textarea id="books" class="books" value="<?php echo $user['about_me']?>" autocomplete="off" name="about_me" style="width: 390px;" rel="books"><?php echo $user['about_me']?></textarea></td>
                              </tr>
                             
                              <tr>
                                <td colspan="2" class="thong_tin"><img class="down_arrow" src="../images/down.png" /><strong>Thông tin liên hệ</strong></td>
                              </tr>
                              <tr>
                                <td class="l">Email: </td>
                                <td class="r"><input type="text" size="70" name="email" class="data" value="<?php echo $user['email']?>" /></td>
                              </tr>
                             
                              <tr>
                                <td colspan="2" class="thong_tin"><img class="down_arrow" src="../images/down.png" /><strong>Công việc và học vấn</strong></td>
                              </tr>
                              <tr>
                                <td class="l"><img src="../images/job.png" width="35px"/></td>
                                <td class="r"><?php foreach ($work as $a_work) {
                                $employer = $dt_xl_employer->xem($a_work['epid']);
								$location = $dt_xl_location->xem($a_work['lcid']);
								$position = $dt_xl_position->xem($a_work['pid']); ?>
                                  <p class="strong_blue">
                                    <?php 
								if (!empty($position)){ 
									echo $position['pname'].' '; 
								}
								if (!empty($employer)) {
									echo $employer['epname'].' ';
								}
								if (!empty($location)) {
									echo 'tại '.$location['lname'].' ';
								}
								if (!empty($a_work['start_date'])&& $a_work['start_date']!='0000-00') {
									echo 'từ '.$a_work['start_date'].' ';
								}
								if (!empty($a_work['end_date'])&& $a_work['end_date']!='0000-00') {
									echo 'đến '.$a_work['end_date'];
								}
								?>
                                  </p>
                                  <?php } ?></td>
                              </tr>
                              <tr>
                                <td class="l"><img src="../images/school.png" width="40px"/></td>
                                <td class="r"><?php 
									foreach ($edu as $an_edu)
									{
									
										$school = $dt_xl_school->xem($an_edu['scid']);
										
										echo '<p class="strong_blue">'.$an_edu['type'].': '.$school['scname'].'</p>';
										$class = $dt_xl_class->xem($an_edu['clid']);
										if (!empty($class)||($an_edu['year'])!=0)
										echo '<p class="ghi_chu">'.$class['clname'].' ('.$an_edu['year'].')</p>';
										else
										echo '<p class="ghi_chu">No info</p>';
									}
									?></td>
                              </tr>
                              <tr>
                                <td colspan="2" class="thong_tin"><img class="down_arrow" src="../images/down.png" /><strong>Sở thích</strong></td>
                              </tr>
                             
                              <tr>
                                <td class="l">Dòng nhạc, thể loại nhạc: </td>
                                <td class="r"><textarea id="music" class="music" value="<?php echo $user['music']?>" autocomplete="off" name="music" style="width: 527px;" rel="sprofile"><?php echo $user['music']?></textarea></td>
                              </tr>
                             
                              <tr>
                                <td class="l">Thể loại sách, tên sách: </td>
                                <td class="r"><textarea id="books" class="books" value="<?php echo $user['books']?>" autocomplete="off" name="books" style="width: 527px;" rel="books"><?php echo $user['books']?></textarea></td>
                              </tr>
                             
                              <tr>
                                <td class="l">Phim ảnh: </td>
                                <td class="r"><textarea id="books" class="books" value="<?php echo $user['movies']?>" autocomplete="off" name="movies" style="width: 527px;" rel="books"><?php echo $user['movies']?></textarea></td>
                              </tr>
                             
                              <tr>
                                <td class="l">Chương trình TV: </td>
                                <td class="r"><textarea id="books" class="books" value="<?php echo $user['tv']?>" autocomplete="off" name="tv" style="width: 527px;" rel="books"><?php echo $user['tv']?></textarea></td>
                              </tr>
                              
							   
                              <tr>
                                <td class="l">Trò chơi: </td>
                                <td class="r"><textarea id="books" class="books" value="<?php echo $user['games']?>" autocomplete="off" name="games" style="width: 527px;" rel="books"><?php echo $user['games']?></textarea></td>
                              </tr>
                             
                              <tr>
                                <td class="l">Sở thích khác: </td>
                                <td class="r"><textarea id="books" class="books" value="<?php echo $user['interests']?>" autocomplete="off" name="interests" style="width: 527px;" rel="books"><?php echo $user['interests']?></textarea></td>
                              </tr>
                             
                              <tr>
                                <td class="l">Hoạt động: </td>
                                <td class="r">
								<textarea id="trich_dan" class="trich_dan" value="<?php echo $user['activities']?>" autocomplete="off" name="activities" style="height: 40px; width: 527px;" rel="sprofile"><?php echo $user['activities']?></textarea>
								</td>
                              </tr>
                             
                            </tbody>
                          </table>
                         
                          <h3>Trích dẫn ưa thích</h3>
                          <blockquote>
                          <p><textarea id="trich_dan" class="trich_dan" value="<?php echo $user['quote']?>" autocomplete="off" name="quote" style="height: 40px; width: 700px;" rel="sprofile"><?php echo $user['quote']?></textarea></p>
                           
                          </blockquote>
                          <div class="bo_nut">
                         <span class="art-button-wrapper"> <span class="art-button-l"> </span> <span class="art-button-r"> </span>
                                  <input type="submit" class="art-button" value="Cập nhật"/>
                                  </span>
                                  <span class="art-button-wrapper"> <span class="art-button-l"> </span> <span class="art-button-r"> </span>
                                  <input type="button" class="art-button" value="Hủy bỏ" onclick="window.location.href='../profile/index.php?id=<?php echo $uid;?>'"/>
                                  </span>
                                  </div>
                        </div>
                      </div>
                      <div class="cleared"></div>
                    </div>
                    <div class="cleared"></div>
                  </div>
                </div>
                <div class="cleared"></div>
              </div>
              <div class="art-layout-cell art-sidebar2">
                <?php 
						  $pos = 'right';
						  sidebar($pos);
						  ?>
                <div class="cleared"></div>
              </div>
            </div>
          </div>
          <div class="cleared"></div>
          <div class="cleared"></div>
        </div>
      </div>
      <div class="art-footer">
        <div class="art-footer-t"></div>
        <div class="art-footer-body"> <a href="#" class="art-rss-tag-icon" title="RSS"></a>
          <div class="art-footer-text">
            <p><a href="#">Link1</a> | <a href="#">Link2</a> | <a href="#">Link3</a></p>
            <p>Copyright © 2012. All Rights Reserved.</p>
            <div class="cleared"></div>
            <p class="art-page-footer"><a href="http://www.artisteer.com/?p=joomla_templates">Joomla template</a> created with Artisteer.</p>
          </div>
          <div class="cleared"></div>
        </div>
      </div>
    </div>
  </div>
</div>
</body>
</html>
